package com.codi.bus.core.dao.impl;

import com.codi.base.dao.v2.GeneratedBaseDaoImpl;
import com.codi.bus.core.dao.BankNameDao;
import com.codi.bus.core.domain.BankName;
import com.google.common.base.Strings;
import org.springframework.stereotype.Repository;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by asus on 2018/2/26.
 */
@Repository("bankNameDao")
public class BankNameDaoImpl extends GeneratedBaseDaoImpl<BankName> implements BankNameDao {

    @Override
    public List<BankName> selectAll() {
        List<BankName> allBankName = this.findList(this.generateStatement("selectAll"),"");
        return allBankName;
    }

    @Override
    public List<BankName> selectByCityAndBank(String cityName, String bankNo) {
        Map<String, Object> map = new HashMap<>();
        map.put("cityName",cityName);
        map.put("bankNo",bankNo);
        List<BankName> cityBank = this.findList(this.generateStatement("selectByCityAndBank"),map);
        return cityBank;
    }

    @Override
    public List<BankName> selectByWord(String bankNo, String word) {
        Map<String, Object> map = new HashMap<>();
        map.put("word",word);
        map.put("bankNo",bankNo);
        List<BankName> fundBank = this.findList(this.generateStatement("selectByWord"),map);
        return fundBank;
    }

    @Override
    public List<String> selectProvince() {
        List<String> provinceNames = this.getSqlSession().selectList(this.generateStatement("selectProvince"),"");
        return provinceNames;
    }

    @Override
    public List<String> selectCity(String ProvinceName) {
        List<String> cityNames = this.getSqlSession().selectList(this.generateStatement("selectCity"),ProvinceName);
        return cityNames;
    }

    @Override
    public String selectBankNo(String vcBranchbank) {
        String bankNo = this.getSqlSession().selectOne(this.generateStatement("selectBankNo"),vcBranchbank);
        return bankNo;
    }

}
